package com.apes.fn.scm.retailOrder.model;

import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @BelongsProject: apes-server
 * @BelongsPackage: com.apes.fn.scm.retailOrder.model
 * @ClassName: BusinessType
 * @Author: pyb
 * @Description: 营业分类
 * @CreateTime: 2021-06-16 15:48
 * @Version: 1.0
 */
@Getter
public enum BusinessType {
    ServicePerformance("ServicePerformance", "服务业绩"), CardSale("CardSale", "年卡销售"), StoredValue("StoredValue", "储值"), Deposit("Deposit", "订金"),
    IntroductionFee("IntroductionFee", "接案介绍费"), UsedCar("UsedCar", "二手车佣金"), FundIncome("FundIncome", "资金收入"), Cross("Cross", "跨公司结算");
    String typeName;
    String businessType;

    BusinessType(String businessType, String typeName) {
        this.businessType = businessType;
        this.typeName = typeName;
    }

    public static BusinessType getBusinessTypeByCode(String businessType) {
        return Arrays.stream(values()).filter(value -> Objects.equals(value.getBusinessType(), businessType)).findFirst().orElse(null);

    }

}
